
import service from '../utils/request'
export const login = async function  (userInfo) {

  console.log(userInfo);
  return await service({
    method: 'post',
    // url: '/user/12345',
    url: '/doctor/login',
    data: {
      tel: userInfo.username,
      password: userInfo.password
    }
  })
}

export const userList = async function  () {
 let userInfo =JSON.parse(localStorage.getItem("userInfo"));

  return await service({
    method: 'get',
    // url: '/user/12345',
    url: `contact/doctor/${userInfo.docId}`,
  })
}


export const saveChatRecord = async function  (msg) {
 
  return await service({
    method: 'post',
    // url: '/user/12345',
    url: `/chatRecord/saveRecord`,
    data:msg
  })
}

export const getChatRecord = async function  (hx1,hx2) {

  return await service({
    method: 'get',
    // url: '/user/12345',
    url: `/chatRecord/getRecords/${hx1}/${hx2}`,

  })
}


export const msgUpload = async function (file) {
  let formData = new FormData(); //构造一个 FormData，把后台需要发送的参数添加
  　　formData.append('file', file); //接口需要传的参数
  console.log(file);
  return await service.post("upload/chatPic", formData, {
    headers: {
      'content-type': 'multipart/form-data'
    }
  })



}